package com.magic.web.dessignmode.config;

import com.magic.web.dessignmode.service.FactoryPatternService;
import com.magic.web.dessignmode.service.impl.FactoryPatternOneServiceImpl;
import com.magic.web.dessignmode.service.impl.FactoryPatternThreeServiceImpl;
import com.magic.web.dessignmode.service.impl.FactoryPatternTwoServiceImpl;
import org.apache.commons.lang3.StringUtils;

/**
 * @description
 * @author wm
 * @date 2021/3/9
 */

public class FactoryPatternConfig {

    public FactoryPatternService getFactoryPattern(String factoryType){
        if (StringUtils.isBlank(factoryType)){
            return null;
        }else if (factoryType.equals("CF")){
            return new FactoryPatternOneServiceImpl();
        }else if (factoryType.equals("CG")){
            return new FactoryPatternTwoServiceImpl();
        }else if (factoryType.equals("TW")){
            return new FactoryPatternThreeServiceImpl();
        }else {
            return null;
        }
    }
}
